package com.example.demo.filter;

import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;

/**
 * 第一种Filter
 * @author LF
 * @date 2021/4/16 - 16:04
 */
    /*@Component
    @Order(-1)*/
    public class WebConfig1 implements Filter {

    /**
     * 这种方式好像没有办法设置 Filter 的拦截规则！是的，直接定义 Bean 的话，默认的拦截规则就是 /* 即拦截所有请求，
     * 开发者无法进行自定义配置
     * @param request
     * @param response
     * @param chain
     * @throws IOException
     * @throws ServletException
     */
        @Override
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
                throws IOException, ServletException {
            System.out.println("-----doFilter-----111111--------------");
            chain.doFilter(request, response);
        }
    }
